package com.lsu.app.mapper;

import com.lsu.app.bean.KvCode;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 *
 * @description 针对表【kv_code(存储键值对的表)】的数据库操作Mapper
 * @Date 2023-11-19 13:41:19
 * @author hjj
 */
@Mapper
public interface KvCodeMapper extends BaseMapper<KvCode> {
    @Select("select * from kv_code where type=4 and value>0")
    List<KvCode> getOneKinds();//获取一级分类
    @Select("select `name` from kv_code where type=5 and value in(select `name` from kv_code where  type=6 and value=#{value})")
    List<String> getTwoKindsName(Integer value);//获取二级分类
    @Select("select COUNT(*) from kv_code where type=4 and name=#{name}")
    Integer isOneKind(String name);//是否为一级分类
    @Select("select value from kv_code where type=4 and name=#{name}")
    Integer getIdBySearch(String name);//获取一级分类的value
}




